package com.sun.temp.utils;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.UUID;

/**
 * ${description}
 *
 * @author wang
 * @since 2024/7/27 16:50
 */
@Component
public class LocalCache {
    public static HashMap<String,String> cache = new HashMap<>();

    static {
        String name = UUID.randomUUID().toString();
        LocalCache.cache.put(String.valueOf(1),name);
//        System.out.println("id为1的数据添加到了缓存");
    }

    @PostConstruct
    public void init() {
        String name = UUID.randomUUID().toString();
        LocalCache.cache.put(String.valueOf(2),name);
//        System.out.println("id为2的数据添加到了缓存");
    }
}